This repository has been archived by the owner on Dec 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
feat: size-efficient list-based ciphertext inputs #120
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Does this support equality of encrypted 2048 bits with cleartext bytes array of length 2048? |
Also note that the trivialEncrypt signature would need to change just for the 2048 bits, because it cannot fir in a uint256... |
dartdart26
force-pushed
the
petar/list-based-inputs
branch
2 times, most recently
from
June 17, 2024 13:40
689a807
to
b534785
Compare
I added it. |
Good point, let's leave it for the future, the PR is huge as it is. |
immortal-tofu
approved these changes
Jun 17, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very heavy PR, but I didn't see any issue. It looks good to me.
dartdart26
force-pushed
the
petar/list-based-inputs
branch
2 times, most recently
from
June 17, 2024 16:19
cfe51dc
to
cda5c9f
Compare
Add support for list-based ciphertext inputs. Two types are supported: * CompactFheUint160List * CompactFheUint2048List No other input types are supported. Instead, the `fhevmjs` library encodes any type other than the FheUint2048 type as FheUint160. In fhevm-go during ciphertext verification, we cast it homomorphically to the requested data type. FheUint2048 values are expanded as is, without any casts. The API of the verifyCiphertext precompile changes such that now it accepts two inputs (through TFHE.asEuintXX() library function in fhevm): * bytes32 Handle * serialized compact FHE list Handle format changes and is no longer the hash of the expanded ciphertext. Instead, input handles have the following format: * byte 0 to 28: first 29 bytes of keccak256(keccak256(serialized compact FHE list) || index) * byte 29: index in the serialized compact FHE list (0-indexed) * byte 30: type of the ciphertext * byte 31: version Non-input handles have the following format: * byte 0 to 29: first 30 bytes of keccak256(serialized compact FHE list) * byte 30: type of the ciphertext * byte 31: version Above allows us to pack multiple inputs in one or more CompactFheUint160Lists. Add support for equality and non-equality of FheUint2048 values. Cleanup should be done in a future commit in order to remove unused code, duplication and to simplify the implementation and the tests, especially around tfhe-rs handling.
dartdart26
force-pushed
the
petar/list-based-inputs
branch
from
June 18, 2024 09:03
cda5c9f
to
07ec249
Compare
dartdart26
added a commit
to zama-ai/fhevm
that referenced
this pull request
Jun 18, 2024
More info: zama-ai/fhevm-go#120 API changes will be described in the documentation. More tests and examples are to be done in a future commit.
dartdart26
added a commit
to zama-ai/fhevm
that referenced
this pull request
Jun 18, 2024
More info: zama-ai/fhevm-go#120 API changes will be described in the documentation. More tests and examples are to be done in a future commit.
dartdart26
added a commit
to zama-ai/fhevm
that referenced
this pull request
Jun 18, 2024
More info: zama-ai/fhevm-go#120 API changes will be described in the documentation. More tests and examples are to be done in a future commit.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add support for list-based ciphertext inputs. Two types are supported:
No other input types are supported. Instead, the
fhevmjs
library encodes any type other than the FheUint2048 type as FheUint160. In fhevm-go during ciphertext verification, we cast it homomorphically to the requested data type. FheUint2048 values are expanded as is, without any casts.The API of the verifyCiphertext precompile changes such that now it accepts two inputs (through TFHE.asEuintXX() library function in fhevm):
Handle format changes and is no longer the hash of the expanded ciphertext. Instead, input handles have the following format:
Non-input handles have the following format:
Above allows us to pack multiple inputs in one or more CompactFheUint160Lists.
Add support for equality and non-equality of FheUint2048 values.
Cleanup should be done in a future commit in order to remove unused code, duplication and to simplify the implementation and the tests, especially around tfhe-rs handling.